/**
 * Company : Thai Informatic System Co., Ltd.
 * Created By : Dr.Tree
 * Created On : Dec 29, 2011  10:19:02 AM 
 * e-Mail : chatree@tis.co.th
 * Mobile Phone : (+66) 087-921-5115
 * Package Name : sap.jco.server
 * File Name : SAPServerInfo.java
 * TODO
 */
package sap.jco.server;

import java.io.IOException;
import promis.utility.CommonService;
import com.tis.utilitys.PropertiesUtility;

/**
 * @author Chatree Siangklom of Administrator
 * Date =Nov 19, 2013 : 3:36:20 PM 
 * CreateBy=Chatree Siangklom
 * 
 * SAPServerInfo
 * TODO
 */
public class SAPServerInfo {
	
	/**
	 * Date =Nov 19, 2013 : 3:35:30 PM 
	 * CreateBy=Chatree Siangklom
	 * int
	 * TODO
	 * @return
	 */
	public static int MaxConnection() {
		try {
			String value =  new PropertiesUtility().GetSapConfigValue("sap.server.max_connection");
			int con_num = CommonService.ConvertStringToBigDecimal(value).intValue();
			return (con_num <= 0) ? 1 : con_num;
			
		} catch (IOException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return 1;
	}

	/**
	 * Date =Nov 19, 2013 : 3:18:48 PM 
	 * CreateBy=Chatree Siangklom
	 * void
	 * TODO
	 */
	public static String Host() {
		try {
			return  new PropertiesUtility().GetSapConfigValue("sap.server.host_or_ip");
		} catch (IOException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
	/**
	 * Date =Nov 19, 2013 : 3:35:33 PM 
	 * CreateBy=Chatree Siangklom
	 * String
	 * TODO
	 * @return
	 */
	public static String User() {
		try {
			return  new PropertiesUtility().GetSapConfigValue("sap.server.user");
		} catch (IOException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
	/**
	 * Date =Nov 19, 2013 : 3:35:36 PM 
	 * CreateBy=Chatree Siangklom
	 * String
	 * TODO
	 * @return
	 */
	public static String Password() {
		try {
			return  new PropertiesUtility().GetSapConfigValue("sap.server.password");
		} catch (IOException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
	/**
	 * Date =Nov 19, 2013 : 3:35:43 PM 
	 * CreateBy=Chatree Siangklom
	 * String
	 * TODO
	 * @return
	 */
	public static String PoolName() {
		try {
			return  new PropertiesUtility().GetSapConfigValue("sap.server.pool_name");
		} catch (IOException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
	/**
	 * Date =Nov 19, 2013 : 3:35:47 PM 
	 * CreateBy=Chatree Siangklom
	 * String
	 * TODO
	 * @return
	 */
	public static String Language() {
		try {
			return  new PropertiesUtility().GetSapConfigValue("sap.server.language");
		} catch (IOException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
	/**
	 * Date =Nov 19, 2013 : 3:35:51 PM 
	 * CreateBy=Chatree Siangklom
	 * String
	 * TODO
	 * @return
	 */
	public static String Client() {
		try {
			return  new PropertiesUtility().GetSapConfigValue("sap.server.client");
		} catch (IOException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
	/**
	 * Date =Nov 19, 2013 : 3:35:56 PM 
	 * CreateBy=Chatree Siangklom
	 * String
	 * TODO
	 * @return
	 */
	public static String Port() {
		try {
			return  new PropertiesUtility().GetSapConfigValue("sap.server.port");
		} catch (IOException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
	/**
	 * Date =Nov 19, 2013 : 3:35:59 PM 
	 * CreateBy=Chatree Siangklom
	 * String
	 * TODO
	 * @return
	 */
	public static String ProgramId() {
		try {
			return  new PropertiesUtility().GetSapConfigValue("sap.server.program_id");
		} catch (IOException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
	/**
	 * Date =Nov 19, 2013 : 3:36:01 PM 
	 * CreateBy=Chatree Siangklom
	 * boolean
	 * TODO
	 * @return
	 */
	public static boolean isUnicode() {
		try {
			
			String isunicode =  new PropertiesUtility().GetSapConfigValue("sap.server.is_unicode");
			if(CommonService.IsNullRString(isunicode).toUpperCase().equals("TRUE"))
				return true;
			else if(CommonService.IsNullRString(isunicode).toUpperCase().equals("FALSE"))
				return false;
			
		} catch (IOException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return true;
	}

	/**
	 * Date =Nov 19, 2013 : 3:36:04 PM 
	 * CreateBy=Chatree Siangklom
	 * String
	 * TODO
	 * @return
	 */
	public static String GatewayService() {
		try {
			return  new PropertiesUtility().GetSapConfigValue("sap.server.gateway_service");
		} catch (IOException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
	/**
	 * Date =Nov 19, 2013 : 3:36:06 PM 
	 * CreateBy=Chatree Siangklom
	 * String
	 * TODO
	 * @return
	 */
	public static String RepositoryName() {
		try {
			return  new PropertiesUtility().GetSapConfigValue("sap.server.repository_name");
		} catch (IOException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
//	SAP Dev Server
//	public static int MAX_Connection = 9;
//	public static String host_or_ip = "192.168.2.44";
//	public static String user = "itonemm";
//	public static String password = "itonemm130";
//	public static String PoolName = "POOL";
//	public static String Language = "EN";
//	public static String Client = "130";
//	public static String port = "81";
//	public static String program_id = "ZDEV_SPL00";
//	public static boolean isUnicode = true;
//	public static String gateway_service = "sapgw81";
//	public static String repositoryName = "REP";
	
//	SAP QA Server
//	public static final int MAX_Connection = 9;
//	public static final String host_or_ip = "192.168.2.45";
//	public static final String user = "itonemm";
//	public static final String password = "itonemm200";
//	public static final String PoolName = "POOL";
//	public static final String Language = "EN";
//	public static final String Client = "200";
//	public static final String port = "71";
//	public static final String program_id = "ZQAS_SPL00";
//	public static final boolean isUnicode = true;
//	public static final String gateway_service = "sapgw71";
//	public static final String repositoryName = "REP";
	
//	SAP QA Server 2012-09-03
//	public static final int MAX_Connection = 9;
//	public static final String host_or_ip = "192.168.2.45";
//	public static final String user = "SPL00CPC01";
//	public static final String password = "webpromis";
//	public static final String PoolName = "POOL";
//	public static final String Language = "EN";
//	public static final String Client = "220";
//	public static final String port = "71";
//	public static final String program_id = "ZQAS_SPL00";
//	public static final boolean isUnicode = true;
//	public static final String gateway_service = "sapgw71";
//	public static final String repositoryName = "REP";
	
//	SAP PROD
//	public static final int MAX_Connection = 9;
//	public static final String host_or_ip = "192.168.2.40";
//	public static final String user = "SPL00CPC01";
//	public static final String password = "webpromis";
//	public static final String PoolName = "POOL";
//	public static final String Language = "EN";
//	public static final String Client = "900";
//	public static final String port = "31";
//	public static final String program_id = "ZPRD_SPL00";
//	public static final boolean isUnicode = true;
//	public static final String gateway_service = "sapgw31";
//	public static final String repositoryName = "REP";
	
}